#ifndef NET_H
#define NET_H

#include "portio.h"

class NetCB
{
	public:
		NetCB() { }
		virtual ~NetCB() { }

		virtual void netIn(int32 Amt) = 0;
		virtual void netOut(int32 Amt) = 0;
		virtual void netErr(uint32 Err) = 0;
		virtual void netTimer(int32 Amt) {};
};

class Net : public PortUser
{
	public:
		Net(HANDLE client, NetCB*);
		~Net();

		bool8 initKeepAlive();
		bool8 initOk();
		void close();

		bool8 read(uint8* Buf, int32 Amt);
		bool8 write(uint8* buf, int32 Amt);
		bool8 isDatatoRead(int32 Amt, int32 index, uint8 val);

	protected:
		void ioDone(DWORD);
		void ioErr(DWORD);
		void ioTimer(DWORD);

	protected:
		NetCB* cb;
		int32 op;
};

#endif
